package com.wn.datasourse;

import com.alibaba.druid.pool.DruidDataSource;
import com.alibaba.druid.pool.DruidDataSourceFactory;

import java.io.InputStream;
import java.sql.Connection;
import java.util.Properties;

public class TestDruid {
    public static void main(String[] args) throws Exception {
        //加载属性文件
        Properties properties = new Properties();

        InputStream inputStream = TestDruid.class.getResourceAsStream("/db.properties");

        properties.load(inputStream);

        DruidDataSource dataSource = (DruidDataSource) DruidDataSourceFactory.createDataSource(properties);

        Connection connection = dataSource.getConnection();
        System.out.println(connection);


    }
}
